if (!jsx3.lang.Class.forName("ux.cdb.admin.test.TestPage")) {

jsx3.Class.defineClass(
        "ux.cdb.admin.test.TestPage",
        jsx3.gui.Block,
        null,
        function (objRoot) {

            /**
             * This function will be called after deserialize
             */
            objRoot.prototype.onAfterDeserialize = function() {
                var me = this;
                this.matrix = this.getDescendantOfName("mtxMain");
                this.searchBar = this.getDescendantOfName("blkSearchBar");
                this.searchBar.setTargetMatrixName(this.matrix);

                this.searchBar.subscribe(ux.cdb.admin.gui.MatrixSearchBar.DO_QUERY, function(msg){
                    alert("Field: " + msg.field + "; Conditon:" + msg.condition + "; KeyWord=" + msg.keyword);
                });

                var path = ux.megatron.Main.getDwrPath();

                var callback = function(obj) {
                    if(!me.matrix) return;
                    var cdf = ux.megatron.util.Dwr.toCdfDocument(obj, "jsxroot");
                    ux.megatron.Main.getServer().getCache().clearById(me.matrix.getXMLId());
                    ux.megatron.Main.getServer().getCache().setDocument("testMatrixObject", cdf);
                    
                    var list = cdf.selectNodes("//record") ;
                    var iterator = list.iterator();
                    var next = null, i=0;
                    while (iterator.hasNext()) {
                        next = iterator.next()
                        next.setAttribute("jsxid", i++);
                    }
                    //me.matrix.setXMLString(cdf.toString());
                    //console.log(ux.megatron.Main.getServer().getCache().getDocument("testMatrixObject"));
                    me.matrix.repaint();  
                };

                ux.megatron.Main.callDwr("People", "People", function() {
                    People.getAllPeople(callback);
                });

            }

            /**
             * called when destroy event fired
             */
            objRoot.prototype.onDestroy = function() {
                this.searchBar.unsubscribe(ux.cdb.admin.gui.MatrixSearchBar.DO_QUERY);
            }
        });
}